package com.biwin.core.main.property;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.context.annotation.Configuration;

/**
 * BiWin Framework Swagger Config Property
 *
 * @author biwin
 * @since 0.0.1
 */
@Configuration
@ConfigurationProperties("biwin.swagger")
public class BiWinSwaggerProperties {

    /**
     * 是否启用 Swagger
     */
    private boolean enable = false;

    /**
     * 用于部署服务器时导致请求地址问题,建议部署服务器时配置,否则直接使用localhost
     */
    private String host;

    /**
     * 使用框架搭建业务系统时配置
     * <p>
     * 用于描述 GroupName 的标题
     */
    private String title = "XX系统业务核心接口文档";

    /**
     * 使用框架搭建业务系统时配置
     * <p>
     * 用于描述 Swagger Docket GroupName
     */
    private String groupName = "Project Business";

    /**
     * 使用框架搭建业务系统时配置
     * <p>
     * 用于描述当前组的信息
     */
    private String description = "业务系统";

    /**
     * 使用框架搭建业务系统时配置
     * <p>
     * 用于描述当前组的版本
     */
    private String version = "V1.0.0";

    /**
     * 使用框架搭建业务系统时配置
     * <p>
     * 用于描述当前组需要扫描的路径, 采用PathAntMatcher
     */
    private String AuthAntPath = "/api/biz**";

    /**
     * 使用框架搭建业务系统时配置
     * <p>
     * 用于描述业务系统哪些路径在使用 Swagger 时,不用权限认证
     */
    private String unAuthAntPath = "^(?!auth).*$";

    /**
     * 联系人信息
     */
    @NestedConfigurationProperty
    private BiWinSwaggerContactProperties contact = new BiWinSwaggerContactProperties();

    public boolean getEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getAuthAntPath() {
        return AuthAntPath;
    }

    public void setAuthAntPath(String authAntPath) {
        AuthAntPath = authAntPath;
    }

    public String getUnAuthAntPath() {
        return unAuthAntPath;
    }

    public void setUnAuthAntPath(String unAuthAntPath) {
        this.unAuthAntPath = unAuthAntPath;
    }

    public BiWinSwaggerContactProperties getContact() {
        return contact;
    }

    public void setContact(BiWinSwaggerContactProperties contact) {
        this.contact = contact;
    }
}
